package com.common.config;

import javax.servlet.http.HttpServletRequest;

import com.common.GlobalPara;
import com.jfinal.plugin.druid.IDruidStatViewAuth;
import com.model.User;
/**
 * 
 * druid监控 页面授权类
 *
 * @author 张龙
 * Nov 7, 2017
 */
public class DruidStatViewAuth implements IDruidStatViewAuth {
	/**
	 * 目前只是判断是否是admin登陆后才能看监控页面
	 */
	@Override
	public boolean isPermitted(HttpServletRequest request) {
		User user = (User)request.getSession().getAttribute(GlobalPara.CURRENT_USER);
		if(user==null || !"admin".equals(user.getLoginId())){
			return false;
		}else{
			return true;
		}
	}

}
